package oo;


class Fish{
    int weight;
}
class Lake{
    Fish fish;
    void setFish(Fish s){
        fish = s;
    }
    void eat(int n){
        fish.weight = fish.weight + n;
    }
}
class FishAndLake{
    public static void main(String[] args) {
        Fish niqiu = new Fish();
        System.out.println(niqiu.weight);//输出1
        Lake TaiHu  = new Lake();
        Lake TaiPingYang = new Lake();
        Lake QingHaiHu = new Lake();
        TaiHu.setFish(niqiu);
        TaiPingYang.setFish(niqiu);
        QingHaiHu.setFish(niqiu);
        TaiHu.eat(15);
        System.out.println(niqiu.weight);
        TaiPingYang.eat(1);
        System.out.println(niqiu.weight);
        QingHaiHu.eat(2);
        System.out.println(niqiu.weight);//输出2
        System.out.println(TaiHu.fish.weight);
        System.out.println(TaiPingYang.fish.weight);
        System.out.println(QingHaiHu.fish.weight);
    }
}
